package model;

public class Machine 
{
	private String _id;
	private String _name;
	
	// desciption of the machine
	private String _description;
	
	// the amount of <items> it produces per second  ( <items> = product from current order )
	private double _currentSpeed;
	
	// the current status of the machine
	private String _status;	
	
	// the order the machine is currently working on
	private ProductionOrder _order;
	
	public Machine(String id, String name, ProductionOrder order,
			String description, double currentSpeed, String status) {
		_id = id;
		_name = name;
		_order = order;
		_description = description;
		_currentSpeed = currentSpeed;
		_status = status;
	}
	
	// update the variables that possibly changed since last scan
	public void processUpdates(double speed, String status, ProductionOrder order) 
	{
		_currentSpeed = speed;
		_status = status;		
		_order.processUpdates(order.getDuration(), order.getEndDateTime(), order.getActualProduct(), 
				order.getActualProductDescription(), order.getActualCount());		
	}

	// getters
	public String getID()
	{
		return _id;
	}

	public String getName() {
		return _name;
	}

	public String getDescription() {
		return _description;
	}

	public double getCurrentSpeed() {
		return _currentSpeed;
	}

	public String getStatus() {
		return _status;
	}

	public ProductionOrder getOrder() {
		return _order;
	}
}
